#pragma once

#include "dictbuilder.h"
#include <wx/ffile.h>

class TxtBuilder : public DictBuilder {

public:
	TxtBuilder(wxString filename);
	~TxtBuilder();

	virtual bool addHeadword(wxString word, wxString def);
    virtual bool write_info();
	virtual bool finish();

	wxString filename() {
		return m_babylonfilename;
	}
    
	unsigned int headwords() {
		return m_entriescount;
	}
	
	unsigned int words() {
		return m_wordcount;
	}
	

protected:

	struct entry {
		unsigned long position;
		unsigned long size;
	};

	wxFFile file;
	wxString m_babylonfilename;

    int m_entriescount;
	
	unsigned int m_size;
	bool m_isOk;

	int m_wordcount;
	int m_headerOffset;
	int m_idxOffset;
	int m_defOffset;

	wxString m_definition;

	// dictionary dic;
};

